<?php

namespace app\model;

use think\Model;

class Project extends Model
{
    public static function getProjects($limit = 10, $offset = 0)
    {
        return self::where('status', 1)
            ->where('isdelete', 0)
            ->order('sort', 'DESC')
//            ->limit($offset, $limit)
            ->select();
    }

    public function getPosterAttr($v)
    {
        return config('site.imgUrl') . $v;
    }

    public function getImgAttr($v)
    {
        return config('site.imgUrl') . $v;
    }

    public function imgs()
    {
        return $this->hasMany('ProjectImg', 'pid', 'id');
    }
}
